#include <stdio.h>
#include "process.h"
#include <unistd.h>
#include <time.h>
#include <stdlib.h>

const int base = 2;
double total = 2048.0;
double once = 0.1;

void download()
{
  double current = 0.0;
  while(current < total)
  {
    //模拟下载行为
    int r = rand() % base + 1;
    double speed = r * once;
    current += speed;
    if(current >= total) current = total;
    usleep(10000);
    
    Process(total,current);
   // printf("test:%.0lf/%.1lf\r",current,total);
   // fflush(stdout);
  }
  printf("\n");
}

int main()
{
  srand(time(NULL));
  download();
  return 0;
}
